﻿<Framework:PageViewBase x:Class="DeSleeper.Client.SystemConfig.SystemView"
              x:TypeArguments="SystemView:SystemViewModel"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:SystemView="clr-namespace:DeSleeper.Client.SystemConfig"
              xmlns:Framework="clr-namespace:DeSleeper.Client.Framework;assembly=DeSleeper.Client.Framework"
              x:Name="_this"
              VerticalAlignment="Stretch"
              HorizontalAlignment="Stretch"
              Height="Auto"
              Width="Auto"
              KeepAlive="True"
              Title="System Page">
    <Grid Margin="12,4"
          DataContext="{Binding ElementName=_this, Path=ViewModel.Interfaces, Mode=OneWay}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*"
                              MinWidth="250" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Label Grid.Column="0"
               Grid.Row="0">Network Adapter:</Label>
        <ComboBox Grid.Column="1"
                  Grid.Row="0"
                  Name="networkAdapter"
                  Text="Select a Network Adapter... "
                  ItemsSource="{Binding}"
                  IsSynchronizedWithCurrentItem="True"
                  DisplayMemberPath="BaseInterface.Description" />

        <Label Grid.Column="0"
               Grid.Row="1"
               HorizontalContentAlignment="Right"
               VerticalAlignment="Center">MAC Address:</Label>
        <TextBox Grid.Column="1"
                 Grid.Row="1"
                 Name="macAddress"
                 Text="{Binding MacAddress, Mode=OneWay}"
                 IsEnabled="False" />

        <StackPanel Grid.Column="1"
                    Grid.Row="2">
            <CheckBox Name="wakeOnLanEnabled"
                      Command="{Binding ElementName=_this, Path=ViewModel.EnableWakeOnLanCommand}"
                      CommandParameter="{Binding /}"
                      IsChecked="{Binding Path=WakeOnLanConfiguration.WakeOnLanEnabled.IsEnabled, Mode=OneWay}"
                      IsEnabled="{Binding Path=WakeOnLanConfiguration.WakeOnLanEnabled.IsSupported, Mode=OneWay}">
                Wake-On-Lan enabled
            </CheckBox>
            <CheckBox Name="wakeOnlyForMagic"
                      Command="{Binding ElementName=_this, Path=ViewModel.EnableWakeOnLanCommand}"
                      CommandParameter="{Binding /}"
                      IsChecked="{Binding Path=WakeOnLanConfiguration.WakeOnLanEnabled.IsEnabled, Mode=OneWay}"
                      IsEnabled="{Binding Path=WakeOnLanConfiguration.WakeOnLanEnabled.IsSupported, Mode=OneWay}">
                Wake only for magic packets
            </CheckBox>
        </StackPanel>

        <Label Grid.Column="0"
               Grid.Row="3">Sleep Timeout:</Label>
        <Grid Grid.Column="1"
              Grid.Row="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBox Name="sleepTimeout"
                     Text="{Binding ElementName=_this, Path=ViewModel.PowerScheme.ACSettings.IdleTimeout, Mode=TwoWay}" />
            <Button Grid.Column="1"
                    Name="updateButton"
                    Command="{Binding ElementName=_this, Path=ViewModel.SetSleepStateCommand}"
                    CommandParameter="{Binding ElementName=_this, Path=ViewModel.PowerScheme, Mode=OneWay}">
                Update
            </Button>
        </Grid>
    </Grid>
</Framework:PageViewBase>
